package sandbox;
import com.rabbitmq.client.*;
public class Producer {

	public static void main (String [] args) throws Exception {
		ConnectionFactory factory = new ConnectionFactory();
		 factory.setUsername("guest");
		 factory.setPassword("guest");
		 factory.setVirtualHost("/");
		 factory.setHost("192.168.1.130");
		 factory.setPort(5672);
		 Connection conn = factory.newConnection();
		      Channel channel = conn.createChannel();
		      String exchangeName = "myExchange1";
		      String routingKey = "testRoute";
		      byte[] messageBodyBytes = ("Hello, world! "+new java.util.Date()).getBytes();
		      channel.basicPublish(exchangeName, routingKey
		,MessageProperties.PERSISTENT_TEXT_PLAIN, messageBodyBytes) ;
		      
		      
		      channel.close();
		      conn.close();
		      }
	
}
